home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / rjs.lha / RJS / String / doc / string.txt < prev    next >
Text File  |  1991-06-14  |  4KB  |  102 lines

  1.  
  2.   In the following descriptions assume:
  3.  
  4.     - S is a String
  5.     - ch is a char
  6.     - n,i,p,l are int's
  7.     - s is a side type (Left,Right,Both)
  8.     - C is either a char, const char *, const String &
  9.     - X is either a C or a const Regex &
  10.     - Y is either a X or a int (pos)
  11.      - Z is either a Y or a int,int (pos and len)
  12.     - R is a Regular Expression
  13.  
  14.     return types --
  15.  
  16.     - bool is an int value where zero is false and non-zero is true
  17.     - ushort is an unsigned short 
  18.     - String& is a reference to S
  19.     - SubString is a SubString within S, and can be used on 
  20.       the left hand of assignment ie. S.after("hello")="good bye";
  21.  
  22. Constructors -
  23.  
  24.   String()
  25.      creates a empty String // String s;
  26.   String(n)
  27.      creates a String with pre-allocated size n // String s(32);
  28.   String(ch)
  29.      creates a String equal to character ch // String space(' ');
  30.   String(const char *)
  31.      creates a String equal to const char * // String word("hello");
  32.   String(const char *s,int n)
  33.      creates a String equal to const char *,with length n // String word(s,4);
  34.   String(const String &s)
  35.      creates a String equal to another String // String s(word);
  36.  
  37. returns        function        description
  38. -------        --------        -----------
  39. String&        S  = X            assigns X to S
  40. String&        S += Y            appends Y to the end of S
  41. String&        S -= Y            removes Y if at end of S
  42. String&        S *= n            multiplies S by n
  43. String&        S /= X            remove all occurances of X from String
  44. String        C1 + C2            concats S2 to S1
  45. String        C1 - C2            removes string S2 if at the end of S1
  46. String        S  / X            remove all occurances of S2 from S1
  47. char        S[i]            returns char indexed by 'i'
  48. SubString    S(Z)            returns the substring Z in S
  49. bool        !S            true if length=0
  50. bool        C1 <  C2        standard relational
  51. bool        C1 <= C2          "          "
  52. bool        C1 == C2          "          "
  53. bool        C1 != C2          "          "
  54. bool        C1 >= C2          "          "
  55. bool        C1 >  C2          "          "
  56. ushort        S.length()        returns length of string
  57. bool        S.empty()        true if length=0
  58. const char*    (const char *) S     converts string to const char *
  59. char*        S.cptr()        converts string to char *
  60. bool(void *)    S            true if length!=0 // if (S) ... 
  61. ostream&    ios << S        outputs string
  62. istream&    ios >> S        inputs string
  63. int        getline(ios,S,ch)    reads a line into S from steam ios, 
  64.                     using delimiter ch,returns length
  65. int        S.index(X)        position of X within S
  66. bool        S.contains(X)        true if S contains X
  67. SubString    S.substr(p)        substring starting at p to end of S
  68. SubString    S.substr(p,l)        substring starting at p with length l
  69. SubString    S.left(n)        left n characters in S
  70. SubString    S.right(n)        right n characters in S
  71. SubString    S.between(n1,n2)    characters between n1 and n2
  72. String&        S.insert(p,C)        inserts C into S at position p
  73. String&        S.prepend(C)        prepends C to S
  74. String&        S.append(C)         appends C to S
  75. String&        S.remove(Z)        removes Z from S
  76. SubString    S.before(Y)        substring S before Y
  77. SubString    S.through(Y)        substring through (upto and including) Y
  78. SubString    S.at(Z)            substring at Z
  79. SubString    S.from(Y)        substring from Y to end of S
  80. SubString    S.after(Y)        substring after Y to end of S
  81. String        S.except(Z)        everything in S except Z
  82. SubString    S.skip(X)        skips optional X, returns substring after
  83. SubString    S.ws()            skips white space
  84. String&        S.replace(X1,X2)    replaces X1 with X2
  85. SubString    S.pos(i)        assigns i current position within S
  86. SubString    S.moveto(X)        moves upto X and returns from X to end
  87. SubString    S.find(X)        finds X in S, return after X to end
  88. SubString    S.match(X)        matches X with leftmost side of S
  89. int        S.split(R,S1[],n)    splits S into string array S1[0..n],
  90.                     on Regex R and returns number split
  91. String&        S.trim(s)        trims white space on side s
  92. String&        S.pad(n,s,ch)        pads to length n with char ch on side s
  93. String&        S.trunc(n)        truncates S to length n
  94. String&        S.upper()        upper cases string
  95. String&        S.lower()        lower cases string
  96. String&        S.reverse()        reverse string
  97. String&        S.icase()        ignores case during next relational 
  98.                     operation // S.icase() < "HELLO"
  99. String&        S.ucase()        uses case during next relational op.
  100. void        S.dump()        dumps out string contents (for debug)
  101. void        S.exception()        exits program and dumps out string
  102.